const express = require('express');
const router = express.Router();
const { check } = require('express-validator');
const messageController = require('../controllers/messageController');
const authMiddleware = require('../middleware/auth');

router.post(
    '/conversations',
    authMiddleware,
    [check('user_ids').isArray().notEmpty().withMessage('User IDs are required')],
    messageController.createConversation
);

router.post(
    '/conversations/:conversation_id',
    authMiddleware,
    [check('content').notEmpty().withMessage('Content is required')],
    messageController.sendMessage
);

router.get('/conversations/:conversation_id', authMiddleware, messageController.getMessages);

module.exports = router;